﻿package mortal.game.view.vip.panel
{
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class VipBecomePanel extends SpecialWindow
    {
        private var _titleTxt:GImageBitmap;
        private var _btn:GLoadingButton;
        private static var _instance:VipBecomePanel;

        public function VipBecomePanel(param1:ILayer = null)
        {
            super(param1);
            this.layer = LayerManager.windowLayer;
            setSize(578, 450);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._titleTxt = UIFactory.gImageBitmap(ImagesConst.VipBecomeTitle, 0, 0, null, this.resetTitle);
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.VipBecomeBg, 6, 40, this));
            this._btn = UIFactory.gLoadingButton(ResFileConst.VipCheckBtn, 169, 387, 251, 43, this);
            this._btn.configEventListener(MouseEvent.CLICK, this.openVipPanel);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._titleTxt.dispose(param1);
            this._titleTxt = null;
            this._btn.dispose(param1);
            this._btn = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function openVipPanel(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.VipWinOpen, null));
            this.hide();
            return;
        }// end function

        private function resetTitle() : void
        {
            if (this.isDisposed)
            {
                return;
            }
            title = this._titleTxt;
            return;
        }// end function

        public static function get instance() : SpecialWindow
        {
            if (_instance == null)
            {
                _instance = new VipBecomePanel;
            }
            return _instance;
        }// end function

    }
}
